// Main nav, breadcrumb, etc...
// stylelint-disable selector-no-type, max-nesting-depth, selector-max-compound-selectors, selector-max-type, selector-max-specificity

.nav-list {
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
  list-style: none;

  .nav-list-item {
    @include fs-4;

    position: relative;
    margin: 0;

    @include mq(md) {
      @include fs-3;
    }

    .nav-list-link {
      display: block;
      min-height: $nav-list-item-height-sm;
      padding-top: $sp-1;
      padding-bottom: $sp-1;
      line-height: #{$nav-list-item-height-sm - 2 * $sp-1};
      @if $nav-list-expander-right {
        padding-right: $nav-list-item-height-sm;
        padding-left: $gutter-spacing-sm;
      } @else {
        padding-right: $gutter-spacing-sm;
        padding-left: $nav-list-item-height-sm;
      }

      &.active {
        background-color: $blazing-red;
        color: white;
      }

      @include mq(md) {
        min-height: $nav-list-item-height;
        line-height: #{$nav-list-item-height - 2 * $sp-1};
        @if $nav-list-expander-right {
          padding-right: $nav-list-item-height;
          padding-left: $gutter-spacing;
        } @else {
          padding-right: $gutter-spacing;
          padding-left: $nav-list-item-height;
        }
      }

      &.external > svg {
        width: $sp-4;
        height: $sp-4;
        vertical-align: text-bottom;
      }

      &.active {
        text-decoration: none;
      }

    }
    
    &:has(ul li.active).active {
      & > .nav-list-link {
        background-color: white;
        color: $blazing-red;
      }
      & > .nav-list-expander {
        color: $blazing-red;
      }
    }

    &:hover,
    &.active {
      & > .nav-list-link {
        background-color: $blazing-red;
        color: white;
      }
      & > .nav-list-expander {
        color: white;
      }
    }

    .nav-list-expander {
      position: absolute;
      @if $nav-list-expander-right {
        right: 0;
      }

      width: $nav-list-item-height-sm;
      height: $nav-list-item-height-sm;
      padding: #{$nav-list-item-height-sm * 0.25};
      color: $link-color;

      @include mq(md) {
        width: $nav-list-item-height;
        height: $nav-list-item-height;
        padding: #{$nav-list-item-height * 0.25};
      }

      @if $nav-list-expander-right {
        svg {
          transform: rotate(90deg);
        }
      }
    }

    > .nav-list {
      display: none;
      padding-left: $sp-3;
      list-style: none;

      .nav-list-item {
        position: relative;
      }
    }

    &.active {
      > .nav-list-expander svg {
        @if $nav-list-expander-right {
          transform: rotate(-90deg);
        } @else {
          transform: rotate(90deg);
        }
      }

      > .nav-list {
        display: block;
      }
    }
  }
}

.nav-category {
  padding: $sp-2 $gutter-spacing-sm;
  text-align: start;
  text-transform: uppercase;
  border-bottom: $border $border-color;
  @include fs-2;

  @include mq(md) {
    padding: $sp-2 $gutter-spacing;
    margin-top: $gutter-spacing-sm;
    text-align: start;

    &:first-child {
      margin-top: 0;
    }
  }
}

.nav-list.nav-category-list {
  > .nav-list-item {
    margin: 0;

    > .nav-list {
      padding: 0;

      > .nav-list-item {
        > .nav-list-link {
          color: $red-200;
        }

        > .nav-list-expander {
          color: $red-200;
        }
      }
    }
  }
}

// Aux nav

.aux-nav {
  display: none;

  @include mq(md) {
    display: block;
    height: 100%;
    overflow-x: auto;
    @include fs-2;

    .aux-nav-list {
      display: flex;
      height: 100%; 
      padding: 0;
      margin: 0;
      list-style: none;
    }

    .aux-nav-list-item {
      display: inline-block;
      height: 100%;
      padding: 0;
      margin: 0;
    }
  }
}

// Breadcrumb nav

.breadcrumb-nav {
  @include mq(md) {
    margin-top: -$sp-4;
  }
}

.breadcrumb-nav-list {
  padding-left: 0;
  margin-bottom: $sp-3;
  list-style: none;
}

.breadcrumb-nav-list-item {
  display: table-cell;
  @include fs-2;

  &::before {
    display: none;
  }

  &::after {
    display: inline-block;
    margin-right: $sp-2;
    margin-left: $sp-2;
    color: $grey-dk-000;
    content: "/";
  }

  &:last-child {
    &::after {
      content: "";
    }
  }
}
